<template>
  <div class="app-container">

    <query :type="type" v-show="showSearch" :query-data.sync="queryData" @getList="getList"/>
    <toobar :type="type" :showSearch.sync="showSearch" @getList="getList" :selectIdList="selectIdList"/>
    <my-table :type="type" v-loading="loading" :table-data="tableData" @getList="getList"
              :selectIdList.sync="selectIdList"/>
    <pagination
      :total="total"
      :page.sync="queryData.pageNum"
      :limit.sync="queryData.pageSize"
      @pagination="getList"
    />

  </div>
</template>

<script>
import Query from './query.vue'
import Toobar from './toobar.vue'
import myTable from './table.vue'
import {listInfo} from "@/api/lion/customerInfo";

export default {
  name: "index",
  components: {Query, Toobar, myTable},
  props: {
    type: {
      /**
       * 类型
       * 1、公共售前客户池
       * 2、我的售前客户池
       * 3、我的后期客户池
       * 4、我的售后客户池
       * 5、团队售前客户池
       * 6、团队后期售后池
       * 7、团队售后客户池
       * 8、待确认至后期
       * 9、待确认至售后
       */
      type: Number,
      required: true
    }
  },
  data() {
    return {
      loading: false,
      // 搜索参数
      queryData: {pageNum: 1, pageSize: 10},
      // 是否显示搜索
      showSearch: true,
      // 表单总条数
      total: 0,
      // 表单数据
      tableData: [],
      selectIdList: [],
      queryRequest: {userId: null, ids:[]}
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      const reminderType = this.$route.query.reminderType;
      this.loading = true
      listInfo({...this.queryData, type: this.type, reminderType}).then(response => {
        this.tableData = response.rows
        this.total = response.total
        this.loading = false
      })
    }
  }
}
</script>

